//
//  HRSearchFunChatFriendViewModel.m
//  Hear
//
//  Created by mac on 2017/8/4.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "HRSearchFunChatFriendViewModel.h"
@implementation HRSearchFunChatFriendViewModel

-(void)postSaveAppTopicUser:(NSDictionary *)requstDict isSeccess:(void(^)(BOOL isSeccess))isSeccess{
    YTKApi *api = [YTKApi apiPostWithUrl:@"App/Post_SaveAppTopicUser" para:requstDict];
    [api getSuccessToken:^() {
        api.foceNoTocken = NO;
        [api setRequestSerializerType:YTKRequestSerializerTypeJSON];
        [api startWithSuccess:^(YTKBaseRequest *request) {
            NSDictionary *dict = request.responseJSONObject;
            if ([dict[@"CodeStatus"] intValue] == 20000){
                isSeccess(YES);
            }else{
                 isSeccess(NO);
            }
        }];
    }];
}



-(void)getMatchUserInfo:(NSDictionary *)requstDict infoModel:(void(^)(HRUpdataUserInfoModel *infoModel))infoModel{
    YTKApi *api = [YTKApi apiGetWithUrl:@"App/Get_GetMatchUserInfo" para:requstDict];
    [api getSuccessToken:^() {
        api.foceNoTocken = NO;
        [api setRequestSerializerType:YTKRequestSerializerTypeJSON];
        [api startWithSuccess:^(YTKBaseRequest *request) {
            NSDictionary *dict = request.responseJSONObject;
            
            // BodyContent
            if ([dict[@"CodeStatus"] intValue] == 20000){
                infoModel([[HRUpdataUserInfoModel class] modelWithJSON:dict[@"BodyContent"]]);

            }else{
                infoModel(nil);
            }
            
        }];
    }];
}


-(void)deleteAppTopicUser:(NSDictionary *)requstDict isSeccess:(void(^)(BOOL isSeccess))isSeccess{
    YTKApi *api = [YTKApi apiDeleteWithUrl:@"App/Delete_DeleteAppTopicUser" para:requstDict];
    [api getSuccessToken:^() {
        api.foceNoTocken = NO;
        [api setRequestSerializerType:YTKRequestSerializerTypeJSON];
        [api startWithSuccess:^(YTKBaseRequest *request) {
            NSDictionary *dict = request.responseJSONObject;
            if ([dict[@"CodeStatus"] intValue] == 20000){
                isSeccess(YES);
            }else{
                isSeccess(NO);
            }
        }];
    }];
}

@end
